This invention relates to methods and systems for computer programming, and particularly, though not exclusively, to methods and systems for assisting the programming of a processor which does not itself provide resources that facilitate efficient programming.
For many years computer programming has generally involved writing sequences of instructions specifying the operations to be performed by a processor in order to accomplish a desired task. Such instructions are expressed in the form of text using a very restricted vocabulary and syntax specific to the programming language employed. This may be an assembly language in which each instruction corresponds to one of the repertoire of primitive operations that the processor can perform, or it may be a `high-level` language in which each instruction represents a more sophisticated operation itself corresponding to several tens or hundreds of primitive operations. In either case the desired task must be analyzed so that it may be defined in complete and unambiguous detail to an extent dependent upon the level of the programming language to be used. The result of this analysis then must be re-expressed in the form of an exactly corresponding computer program.
Even though present high-level languages enable very complex operations to be defined by each instruction, a typical computer program contains many hundreds or thousands of instructions arranged in an intricate inter-relationship. This provides copious possibilities for errors or deficiencies in the programmed expression of the task to be performed, resulting in failure or inappropriate operation of the computer when it executes the program. The essentially textual format of typical programming languages significantly exacerbates the problem of assimilating and understanding the operation of a program so that it may be compared with desired functions and corrected and extended as necessary.
Various attempts have been made in recent years to alleviate different apects of this problem. Thus a system called PegaSys provides a capability to describe graphically the design of a separately written textual program. This description provides a form of documentation of the program and can also be verified by the system both for internal consistency and for conformity with the textual version (IEEE Computer, Vol. 18, No. 8, August 1985, pp. 72-85). Another system, developed at Brown University, Rhode Island and known as Pecan, enables a program to be written in a language such as Pascal with a text editor which uses information about the allowable syntax of the language to assist the programmer in writing the program (a syntax-directed editor). Representations of the program using other display conventions are simultaneously maintained to provide alternative views of the program and its structure (Sigplan Notices, Vol. 19, No. 5, May 1984, pp. 30-41).
Techniques have been developed for visual illustration of the execution of a program by animation of a graphical depiction of the program structure. In the Program Visualization project the user creates graphical pictures and links them to program code and data; these graphical representations or icons can be used during execution monitoring to illustrate progress through the program (IEEE Computer, Vol. 18, No. 8, August 1985, p. 20). A technique has been described for animating programs written in the object-oriented programming language known as Smalltalk. Special additional instructions are inserted at user-selected points in the program to cause a corresponding change in a graphic display when the section of the program containing such a special instruction is executed (ibid., pp. 61-71). Another system developed at Brown University likewise enables selected aspects of program execution to be illustrated graphically (IEEE Software, Vol. 2, No. 1, Jan. 85, pp. 28-39). The Pecan system noted above also provides the capability of executing the program and highlighting each statement in the program as it is executed.
Graphical techniques have been devised for writing progams by manipulation of graphical representations of program instructions. The Omega system developed at Berkeley, California allows the programmer to construct programs interactively by pointing to graphical structures on a display screen and moving them around, but the structures only represent elements of the program, the actual details of which have to be specified in a form of text (IEEE Computer, Vol. 18, No. 8, August 1985, p. 20). Other systems such as PiP (ibid., p. 23) and Think Pad (IEEE Software, Vol. 2, No. 2, Mar. 85, pp. 73-79) enable programming to be performed by drawing and modifying pictorial representations of data structures to be manipulated by the program.
However, even these known techniques fail to provide an optimum programming environment. Thus in many cases the programming still has to be performed by writing instructions in textual format and is typically done on the actual computer system which is intended to execute the finished program when it is in use. Consequently the system may have very limited facilities for program writing and debugging (a low-resolution display, precluding the use of effective graphics, and a simple monitor utility), or else the system may have such sophisticated and expensive facilities that it is not suitable or cost effective for executing the program in its intended operational environment. Furthermore existing systems for providing an animated display of program execution generally cannot illustrate multi-process programs, and/or cannot incorporate timing constraints that are important in programming real-time processes for controlling and/or responding to events occurring externally of the processor.